/*wikinvest/javascript/errorHandler.js*/
if (false) {
    (function () {
        var _errors = new Array();
        var location = window.location.href;
        var timer = null;
        var isLoaded = false;
        window.onerror = function (msg, file, line) {
            for (var i = 0; i < _errors.length; i++) {
                if (_errors[i].msg == msg && _errors[i].file == file && _errors[i].line == line) {
                    return;
                }
            }
            _errors.push({
                msg: msg,
                file: file,
                line: line
            });
            if (isLoaded) {
                if (timer !== null) {
                    clearTimeout(timer);
                }
                setTimeout(_sendErrors, 2000);
            }
        };
        var _sendErrors = function () {
            isLoaded = true;
            if (_errors.length === 0) {
                return;
            }
            var allUrls = new Array();
            var url = "";
            for (var i = 0; i < _errors.length; i++) {
                var error = _errors[i];
                url += "&msgs[" + i + "]=" + encodeURIComponent(error.msg);
                url += "&files[" + i + "]=" + encodeURIComponent(error.file);
                url += "&lines[" + i + "]=" + encodeURIComponent(error.line);
                if (url.length > 1750) {
                    allUrls.push(url);
                    url = "";
                }
            }
            if (url !== "") {
                allUrls.push(url);
            }
            for (var i = 0; i < allUrls.length; i++) {
                var params = "?i=" + i + "&time=" + new Date().getTime() + "&location=" +
                    encodeURIComponent(location) + allUrls[i];
                var img = new Image();
                img.src = nv.Urls.ServerUrl + "/wikinvest/javascript/errorLogger.php" + params;
            }
            _errors = new Array();
        };
        if (window.addEventListener) {
            window.addEventListener('load', _sendErrors, false);
        } else if (window.attachEvent) {
            window.attachEvent('onload', _sendErrors);
        } else {
            var _onload = window.onload;
            window.onload = function () {
                if (_onload) {
                    _onload();
                }
                _sendErrors();
            };
        }
    })();
}
/* /wikinvest/javascript/errorHandler.js*/